package day06;

import java.util.Random;

public class MathodDemo {
    public static void main(String[] args) {
        say();
        say("SJH");
        say("SJH",18);

        int m=5;
        int n=6;
        System.out.println(sum(m,n));


        int[] c = getRandomArray(20,10);
        for(int i=0;i<c.length;i++){
            System.out.println(c[i]);
        }
        System.out.println("-------------------");
        int[] d = getRandomArray(5,1000);
        for(int i=0;i<d.length;i++){
            System.out.println(d[i]);
        }

    }
    public static void say(){
        System.out.println("大家好");
    }

    public static void say(String name){
        System.out.println("大家好,我叫"+name);
    }

    //public static void sayHello(String name, int age){
       // System.out.println("大家好,我叫"+name+",我今年"+age+"岁了");

   // }

    public static int sum(int num1,int num2){
        return num1+num2;
    }

    public static int[] getRandomArray(int len,int max){
        Random rand = new Random();
        int[] arr = new int[len];
        for(int i=0;i<arr.length;i++){
            arr[i]=rand.nextInt(max+1);

        }
        return arr;
    }

    public static void say(String name,int age){
        if(age>=60){
            return;
        }
        System.out.println("大家好,我叫"+name+",我今年"+age+"岁了");

    }
}
